import {ApiProperty, ApiPropertyOptional} from '@nestjs/swagger';
import {IsNotEmpty, IsNumber, IsOptional, IsString} from 'class-validator';

export class UpdateDishDto {
    @ApiPropertyOptional({description: '菜品名称'})
    @IsOptional()
    @IsNotEmpty({message: '菜品名称不能为空'})
    @IsString({message: '菜品名称必须是字符串类型'})
    readonly name?: string;

    @ApiPropertyOptional({description: '菜品描述'})
    @IsOptional()
    @IsString({message: '菜品描述必须是字符串类型'})
    readonly description?: string;

    @ApiPropertyOptional({description: '菜品价格'})
    @IsOptional()
    @IsNotEmpty({message: '菜品价格不能为空'})
    @IsNumber({}, {message: '菜品价格必须是数字类型'})
    readonly price?: number;

    @ApiPropertyOptional({description: '菜品图片'})
    @IsOptional()
    @IsString({message: '菜品图片必须是字符串类型'})
    readonly image?: string;

    @ApiPropertyOptional({description: '菜品类别 ID'})
    @IsOptional()
    @IsNotEmpty({message: '菜品类别 ID 不能为空'})
    @IsNumber({}, {message: '菜品类别 ID 必须是数字类型'})
    readonly categoryId?: number;

    @ApiPropertyOptional({description: '餐厅 ID'})
    @IsNotEmpty({message: '餐厅 ID 不能为空'})
    @IsNumber({}, {message: '餐厅 ID 必须是数字类型'})
    readonly restaurantId?: number;

    @ApiProperty({description: '菜品库存'})
    @IsOptional()
    @IsNumber({}, {message: '菜品库存必须是数字类型'})
    readonly stock?: number;

    @ApiProperty({description: '是否售罄'})
    @IsOptional()
    @IsNumber({}, {message: '是否售罄必须是布尔类型'})
    readonly soldOut?: boolean;


    @ApiProperty({description: '菜品排序'})
    @IsOptional()
    @IsNumber({}, {message: '菜品排序必须是数字类型'})
    readonly sort?: number;
}
